package com.example.service.impl;


import com.example.dao.GoodsMapper;
import com.example.dto.GoodsDTO;
import com.example.rvo.ResultVO;
import com.example.service.GoodsService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 可以不用单独配置pagehelper
 */
@Service
public class GoodsServiceImpl implements GoodsService {

    @Resource
    private GoodsMapper goodsMapper;
    @Override
    public ResultVO queryGoods(int page, int limit) {
        PageHelper.startPage(page, limit);
        List<GoodsDTO> goodsDTOS = goodsMapper.queryGoods();
        PageInfo pageInfo = new PageInfo(goodsDTOS);
        return ResultVO.success("200","success",pageInfo);
    }

}
